<?php


namespace RedMVC\Form\Validator;

/**
 * Email class
 *  
 * @category    RedMVC
 * @package     Form
 * @subpackage  Validator 
 * @author      Jan Fischer, bitWorking <info@bitworking.de>
 */
class Email extends AValidator{
    public function isValid($value, $formValues = null){
        $check = preg_match( "/^        
                [\d\w\/+!=#|$?%{^&}*`'~-]
                [\d\w\/\.+!=#|$?%{^&}*`'~-]*@        
                [A-Z0-9]        
                [A-Z0-9.-]{1,61}        
                [A-Z0-9]\.        
                [A-Z]{2,6}$/ix", $value );
        if($check==0 || $check==false){
            $this->setError('FORM_VALIDATOR_EMAIL', $value);
            return false;
        }
        return true;
    }
}